import {ADDCOUNTER,ADDTOCATR} from './mutations_type'

export default {
  addcats(context,payload) {
    let newoptions =context.state.addcatslist.find(item => item.iid===payload.iid)
    return new Promise((res,rej)=>{
    if(newoptions){
      context.commit(ADDCOUNTER,newoptions)
      res('购买数量+1')
    }else{
      payload.count=1
      context.commit(ADDTOCATR,payload)
      res('成功加入购物车')
    }
    })

  }
 }


